package com.dj.ms.configure;

import com.dj.common.support.ControllerRequestMapping;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

/**
 * <br>
 * <p>
 * - 重写spring#WebMvcRegistrations
 * </p>
 *
 * <br>
 *
 * @author ZJG
 * @version 1.0
 * @date 2021/11/12 上午11:12
 */
@Configuration
@Order(Ordered.HIGHEST_PRECEDENCE)
public class SpringWebMvcRegistration implements WebMvcRegistrations {

    @Value("${spring.web.mvc.print-mapping-path:true}")
    private boolean showMappingPath;

    @Override
    public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
        return new ControllerRequestMapping(showMappingPath);
    }

}
